<template>
  <div>
    <el-drawer
      title="知识库目录"
      :visible.sync="drawermemu"
      :direction="drawermemudirection"
      size="80%"
    >
      <el-container style="height: 600px">
        <el-main>
          <knowledge-memu
          style="margin-top:-20px"
            :memulist="memulist"
            @handleCheckChange="handleCheckChange"
          ></knowledge-memu>
        </el-main>
      </el-container>
    </el-drawer>
  </div>
</template>
  
  <script>
import WorkUserTree from "../WorkUser/WorkUserTree.vue";
import KnowledgeMemu from "./KnowledgeMemu.vue";

export default {
  components: { WorkUserTree, KnowledgeMemu },
  props: ["memulist"],

  data() {
    return {
      drawermemu: false,
      drawermemudirection: "ltr",
    };
  },

  methods: {
    async getkeymapname() {
      this.tableid = Object.keys(this.tableData[0]);
      let datas = {
        keyname: this.tableid,
      };
      this.$axios
        .post("api/getkeymapname", datas)
        .then((response) => {
          this.tablename = response.data;
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    handleCheckChange(data) {
      if (!data.hasOwnProperty('children')) {
        this.$parent.getcontent(data)
      }     
    },

    exportExcelData() {
      this.getkeymapkey();
    },

    async getkeymapkey() {
      let datas = {
        keyname: this.tableTitle,
      };
      this.$axios
        .post("api/getkeymapkey", datas)
        .then((response) => {
          this.tableid = response.data;
          export2Excel(
            this.tableTitle,
            this.tableid,
            this.tableData,
            "人员信息导出"
          );
        })
        .catch(function (error) {
          console.log(error);
        });
    },

    usersearch() {
      this.$emit("usersearch");
    },

    onclean() {
      this.$emit("onclean");
    },
  },
};
</script>
  
  <style lang="scss" scoped>
</style>